<?php

namespace App\Enums;

use App\Traits\EnumMethods;

enum OrderState: string
{
    use EnumMethods;

    case INIT = 'init';
    case PAID = 'paid';
    case REFUND = 'refund';
    case REFUNDED = 'refunded';

    const STATE_MAP = [
        self::INIT->value => '初始化',
        self::PAID->value => '支付成功',
        self::REFUND->value => '退款中',
        self::REFUNDED->value => '退款成功',
    ];

    const STATE_LABEL = [
        self::INIT->value => 'default',
        self::PAID->value => 'success',
        self::REFUND->value => 'info',
        self::REFUNDED->value => 'primary',
    ];

    public function toString(): string
    {
        return self::STATE_MAP[$this->value];
    }
}
